package com.base.common.listening;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Session监听
 * 
 * @author tcq
 * @date 2019年6月11日 上午10:55:20
 */
@WebListener
public class SessionListener implements HttpSessionListener, HttpSessionAttributeListener {

	private static final Logger log = LoggerFactory.getLogger(SessionListener.class);

	@Override
	public void attributeAdded(HttpSessionBindingEvent se) {
		HttpSessionAttributeListener.super.attributeAdded(se);
		log.info("--attributeAdded--");
	}

	@Override
	public void attributeRemoved(HttpSessionBindingEvent se) {
		log.info("--attributeRemoved--");
		HttpSessionAttributeListener.super.attributeRemoved(se);
	}

	@Override
	public void attributeReplaced(HttpSessionBindingEvent se) {
		log.info("--attributeReplaced--");
		HttpSessionAttributeListener.super.attributeReplaced(se);
	}

	@Override
	public void sessionCreated(HttpSessionEvent se) {
		log.info("---sessionCreated----");
		HttpSessionListener.super.sessionCreated(se);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {
		log.info("---sessionDestroyed----");
		HttpSessionListener.super.sessionDestroyed(se);
	}

}
